import { View, Image } from '@tarojs/components';
// import useNavInfo from '@/utils/useNavInfo';
import React, { Component } from "react";
import Taro from '@tarojs/taro'
import './index.scss'
import PropTypes from 'prop-types';

interface NavBarProps extends BaseComponentProps {
  name: string,
}

class NavBar extends Component<NavBarProps, any> {

  static propTypes = {
    name: PropTypes.string,
  }

  static defaultProps = {
    name: "",
  }

  constructor(props) {
    super(props);
  }

  backNav() {
    Taro.navigateBack();
  }

  render() {
    const { statusBarHeight } = Taro.getSystemInfoSync()
    const { name } = this.props
    return (
      <View className='nav' style={{ marginTop: statusBarHeight }}>
        <View className='nav_back' onClick={this.backNav.bind(this)} >
          <Image src={require("@/assets/icons//public/nav_back_white.svg")} style='height:24px;width:24px;'></Image>
        </View>
        <View className='nav_title' >{name}</View>
      </View>
    );
  }
}

export default NavBar;

